<!--登记开票-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <title>首页</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<div    id="content">
    <section class="content-header">
        <h1>
            <i class="fa fa-dashboard"></i>
            <strong>应收账管理</strong>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-home "></i>Home</a></li>
            <li>收账/开票登记</li>
            <li class="active">登记收账</li>
        </ol>
    </section>
    <!-- Main content -->
    <section class="content">
        <div class="row">
            <div class="col-md-12">
                <div class="box box-info">
                    <div class="widget-content nopadding">
                        <form id="paymentRegist">
                        <table class="table table-bordered">
                            <tbody>
                            <tr>
                                <td width="8%" class="center">合同编号</td>
                                <td width="16%">
                                    <div class="col-md-11">
                                        <input class="form-control" type="text"  readonly="readonly" name="code" th:value="${contract.supplierCode}"/>
                                        <input class="form-control" type="hidden" id="contractId" name="contractId" th:value="${contract.Id}"/>
                                        <input class="form-control" type="hidden" id="contractType" name="contractId" th:value="${contract.contractType}"/>
                                    </div>
                                </td>
                                <td width="8%" class="center">公司名称</td>
                                <td width="16%">
                                    <div class="col-md-12">
                                        <input class="form-control" type="text" readonly="readonly" name="compName"  th:value="${contract.orderUnit}"/>
                                    </div>
                                </td>

                                <td width="8%" class="center">合同总额(元)</td>
                                <td width="16%">
                                    <div class="col-md-11">
                                        <input class="form-control" type="text"  readonly="readonly" name="paySum" th:value="${#numbers.formatDecimal(contract.totalSum,1,2)}"/>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td width="8%" class="center">负责人</td>
                                <td width="16%">
                                    <div class="col-md-11">
                                        <input class="form-control" type="text" readonly="readonly" name="receiver" th:value="${contract.dutyOfficer}"/>
                                    </div>
                                </td>
                                <td width="8%" class="center">签订时间</td>
                                <td width="16%">
                                    <div class="col-md-12">
                                            <input class="form-control" type="text"
                                                   readonly="readonly" id="signedDate1"
                                                   disabled="disabled"/>
                                            <input class="hide" type="text"
                                                   readonly="readonly" id="signedDate"
                                                   disabled="disabled"
                                                   th:value="${contract.signedDate}"/>
                                    </div>
                                </td>
                                <td width="8%" class="center">交货时间</td>
                                <td width="16%">
                                    <div class="col-md-11">
                                        <input class="form-control" type="text"
                                               id="giveOutDate1" readonly="readonly"
                                               disabled="disabled"/>
                                        <input class="hide" type="text"
                                               id="giveOutDate" readonly="readonly"
                                               disabled="disabled"
                                               th:value="${contract.giveOutDate}"/>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td width="8%" class="center">项目名称</td>
                                <td colspan="3">
                                    <div class="col-md-12">
                                        <input class="form-control" type="text"  readonly="readonly" name="name" th:value="${contract.projectName}"/>
                                    </div>
                                </td>
                                <td width="8%" class="center">片区/行业</td>
                                <td width="16%">
                                    <div class="col-md-11">
                                        <input class="form-control" type="text" readonly="readonly" name="arae" th:value="${contract.orderArea}"/>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td width="8%" class="center">备注</td>
                                <td colspan="3">
                                    <div class="col-md-12">
                                        <textarea class="form-control" style="width:100%" row="2" readonly="readonly" th:value="${contract.memo}"></textarea>
                                    </div>
                                </td>
                            </tr>
                            </tbody>
                            </table>
                        </form>
                    </div>
                            <!-- Custom Tabs -->
                            <div class="nav-tabs-custom">
                                <ul class="nav nav-tabs" id="myTabs">
                                    <li class="payHistory"><a href="#tab_1" data-toggle="tab">回款计划</a></li>
                                    <li><a href="#tab_2" class="showOldPay" data-toggle="tab">回款历史</a></li>
                                    <li><a href="#tab_3" class="active" data-toggle="tab">开票历史</a></li>
                                    <li><a href="#tab_4" class="showOldPaid" data-toggle="tab">回款-计划</a></li>
                                    <li><a href="#tab_5" class="showOldPayment" data-toggle="tab">开票-计划</a></li>
                                    <button  type="button" class="btn btn-info pull-right editPaymentBtn">编辑开票</button>
                                </ul>
                                <!--th:if="${module.canRead==true}"-->
                                <div class="tab-content">
                                    <div class="tab-pane active" id="tab_1">
                                        <table id="scheduleTable" class="mytable dataTable table-bordered text-center table-striped table-hover" cellspacing="0" width="100%">
                                            <thead>
                                            <tr>
                                                <th width="20%" >序号</th>
                                                <th width="20%" >款项</th>
                                                <th width="20%" >金额(元)</th>
                                                <th width="20%" >计划收款时间</th>
                                                <th width="20%" >备注</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class="tab-pane" id="tab_2">
                                        <table id="payTable" class="mytable dataTable table-bordered text-center table-striped table-hover" cellspacing="0" width="100%" type="2">
                                            <thead>
                                            <tr>
                                                <th width="10%">序号</th>
                                                <th width="10%">操作</th>
                                                <th width="20%">回款金额(元)</th>
                                                <th width="20%">回款方式</th>
                                                <th width="20%">回款时间</th>
                                                <th width="10%">汇款人</th>
                                                <th width="10%">备注</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            </tbody>
                                        </table>
                                        <table class="table table-bordered">
                                            <tbody>
                                            <tr>
                                                <td width="8%" class="center">合同总金额</td>
                                                <td width="16%">
                                                    <div class="col-md-11">
                                                        <div class="input-group">
                                                        <input class="form-control" type="text" name="paidSum1" id="paySum1" th:value="${#numbers.formatDecimal(contract.totalSum,1,2)}" readonly="readonly"/>
                                                        <span  class="input-group-addon">元</span>
                                                        </div>
                                                    </div>
                                                </td>
                                                <td width="8%" class="center">回款总金额</td>
                                                <td width="16%">
                                                    <div class="col-md-11">
                                                        <div class="input-group">
                                                        <input class="form-control" type="text" name="paidSum" id="paidSum" readonly="readonly" th:value="${#numbers.formatDecimal(paidSum,1,2)}"/>
                                                        <span  class="input-group-addon">元</span>
                                                            </div>
                                                    </div>
                                                </td>
                                                <td width="8%" class="center">剩余金额</td>
                                                <td width="16%">
                                                    <div class="col-md-11">
                                                        <div class="input-group">
                                                        <input class="form-control" type="text" name="paidRemain" id="paidRemain" readonly="readonly" th:value="${#numbers.formatDecimal(contract.totalSum-paidSum,1,2)}"/>
                                                        <span  class="input-group-addon">元</span>
                                                            </div>
                                                    </div>
                                                </td>
                                            </tr>
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class="tab-pane" id="tab_3">
                                        <table id="paymentTable" class="mytable dataTable table-bordered text-center table-striped table-hover" cellspacing="0" width="100%" type="3">
                                            <thead>
                                            <tr>
                                                <th width="10%">操作</th>
                                                <th width="10%">序号</th>
                                                <th width="20%">开票金额(元)</th>
                                                <th width="20%">开票时间</th>
                                                <th width="20%">开票人</th>
                                                <th width="20%">备注</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            </tbody>
                                        </table>
                                        <table class="table table-bordered">
                                        <tbody>
                                        <tr>
                                            <td width="8%" class="center">合同总金额</td>
                                            <td width="16%">
                                                <div class="col-md-11">
                                                    <div class="input-group">
                                                    <input class="form-control" type="text" name="paidSum2" id="paySum2" th:value="${contract.totalSum}" readonly="readonly"/>
                                                    <span  class="input-group-addon">元</span>
                                                    </div>
                                                </div>
                                            </td>
                                            <td width="8%" class="center">开票总金额</td>
                                            <td width="16%">
                                                <div class="col-md-11">
                                                    <div class="input-group">
                                                    <input class="form-control" type="text" name="payment" id="payment" readonly="readonly" th:value="${paymentSum}"/>
                                                    <span  class="input-group-addon">元</span>
                                                    </div>
                                                </div>
                                            </td>
                                            <td width="8%" class="center">剩余金额</td>
                                            <td width="16%">
                                                <div class="col-md-11">
                                                    <div class="input-group">
                                                    <input class="form-control" type="text" name="remain" id="remain" readonly="readonly" th:value="${contract.totalSum-paymentSum}"/>
                                                    <span  class="input-group-addon">元</span>
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                        </tbody>
                                    </table>
                                    </div>
                                    <div class="tab-pane" id="tab_4">
                                        <table id="paidScheduleTable" class="mytable dataTable table-bordered text-center table-striped table-hover" cellspacing="0" width="100%">
                                            <thead>
                                            <tr>
                                                <th width="10%" >序号</th>
                                                <th width="10%" >款项</th>
                                                <th width="15%" >回款计划金额(元)</th>
                                                <th width="15%" >回款金额进度(元)</th>
                                                <th width="20%" >计划收款时间</th>
                                                <th width="15%" >回款时间偏差(天)</th>
                                                <th width="15%" >备注</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class="tab-pane" id="tab_5">
                                        <table id="paymentScheduleTable" class="mytable dataTable table-bordered text-center table-striped table-hover" cellspacing="0" width="100%">
                                            <thead>
                                            <tr>
                                                <th width="20%" >序号</th>
                                                <th width="20%" >款项</th>
                                                <th width="20%" >开票金额进度(元)</th>
                                                <th width="20%" >计划收款时间</th>
                                                <th width="20%" >备注</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            </tbody>
                                        </table>
                                    </div>
                                </div><!-- /.tab-content -->
                            </div><!-- nav-tabs-custom -->
                    <a type="button" class="btn btn-default pull-right"  href="javascript:history.go(-1)">返回</a>
                    <button type="button" class="btn btn-primary pull-right savePaymentBtn">保存</button>
                </div>
             </div>
          </div>
    </section>
    <!--开票历史编辑弹窗-->
    <div class="modal" id="registPaymentEditModal">
        <div class="modal-dialog" role="dialog">
            <form id="registPaymentEditForm">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title"><strong>开票历史修改</strong></h4>
                    </div>
                    <div class="modal-body">
                        <input type="hidden" name="id1" id="id1" />
                        <div class="form-horizontal">
                            <div class="form-group">
                                <label class="col-md-2 control-label">开票金额</label>
                                <div class="col-md-4">
                                    <div class="col-md-10">
                                        <div class="input-group">
                                        <input class="form-control" type="text" name="paymentSum1" id="paymentSum1" readonly="readonly"/>
                                        <span  class="input-group-addon">元</span>
                                        </div>
                                        </div>
                                    <div class="col-md-1">
                                        <span style="color:#F00">*</span>
                                    </div>
                                </div>
                                <label class="col-md-2 control-label">开票人</label>
                                <div class="col-md-4">
                                    <div class="col-md-10">
                                        <input class="form-control" type="text"  name="paymentMan1" id="paymentMan1" readonly="readonly"/>
                                    </div>
                                    <div class="col-md-1">
                                        <span style="color:#F00">*</span>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-2 control-label">开票时间</label>
                                <div class="col-md-4">
                                    <div class="col-md-10">
                                    <input class="form-control" type="date" name="paymentDate1" id="paymentDate1" readonly="readonly"/>
                                    </div>
                                        <div class="col-md-1">
                                        <span style="color:#F00">*</span>
                                    </div>
                                </div>
                                <label class="col-md-2 control-label">税率</label>
                                    <div class="col-md-4">
                                        <div class="col-md-10">
                                        <div class="input-group">
                                            <select class="form-control" type="text" name="taxRate" id="taxRate">
                                                <option>17</option>
                                                <option>2</option>
                                                <option>5</option>
                                            </select>
                                            <span  class="input-group-addon">%</span>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-2 control-label">是否确认收入</label>
                                <div class="col-md-4">
                                    <div class="col-md-10">
                                    <select class="form-control" type="tex"  name="isInIncome" id="isInIncome">
                                        <option>是</option>
                                        <option>否</option>
                                    </select>
                                    </div>
                                </div>
                                <label class="col-md-2 control-label">税金</label>
                                <div class="col-md-4">
                                    <div class="col-md-10">
                                        <div class="input-group">
                                        <input class="form-control" type="text" name="taxes" id="taxes" value="0"/>
                                        <span  class="input-group-addon">元</span>
                                        </div>
                                </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-md-2 control-label">备注</label>
                                <div class="col-md-8">
                                    <div class="col-md-12">
                                    <textarea class="form-control" style="width:100%" name="memo2" id="memo2" row="2" ></textarea>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-primary savePaymentBtn1" >保存</button>
                        <button type="button" class="btn btn-default" data-dismiss="modal">返回</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <script th:src="@{/payment/registPayFinance.js}"></script>
    <script>
        $(function () {
            $('#myTabs a[href="#tab_3"]').tab('show');
            $('.editPaymentBtn').show();
            $('#myTabs a[href="#tab_1"]').click(function (e) {
                e.preventDefault();
                $('.editPaymentBtn').hide();
            });
            $('#myTabs a[href="#tab_2"]').click(function (e) {
                e.preventDefault();
                $('.editPaymentBtn').hide();
            });
            $('#myTabs a[href="#tab_3"]').click(function (e) {
                e.preventDefault();
                $('.editPaymentBtn').show();
            });
            $('#myTabs a[href="#tab_4"]').click(function (e) {
                e.preventDefault();
                $('.editPaymentBtn').hide();
            });
            $('#myTabs a[href="#tab_5"]').click(function (e) {
                e.preventDefault();
                $('.editPaymentBtn').hide();
            })
        })
        jQuery(function() {
            if (jQuery("#giveOutDate").val() != '') {
                var sendDate = jQuery("#giveOutDate").val();
                jQuery("#giveOutDate1").val(
                        moment(sendDate).format('YYYY-MM-DD'));
            }
            if (jQuery("#signedDate").val() != '') {
                var sendDate = jQuery("#signedDate").val();
                jQuery("#signedDate1").val(
                        moment(sendDate).format('YYYY-MM-DD'));
            }
        });
    </script>
</div>
</body>
</html>